AWS Elastic Beanstalk Docker 環境へDeep Security Agentをインストールする

AWS Elastic Beanstalk Docker 環境へDeep Security Agentをインストールする

Clock Icon2016.06.20

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは、コカコーラ大好き、カジです。

AWS Elastic Beanstalk Docker 環境でのDeep Security Agentインストールしたのでご紹介します。 弊社都元にも調査にご協力をいただきました。ありがとうございました。

Elastic Beanstalk 環境のDeep Securityの対応について

Deep Security のElastic Beanstalk対応についてはこのIntegrate Deep Security as a Service with AWS Beanstalkが参考になります。 サンプルの.ebestentionのサンプルファイルも提供されています。

Docker 環境のDeep Securityの対応について

Deep SecurityのDocker環境の保護についてはCan I use Deep Security to protect my Docker containers?に記載があります。まとめると以下となります。

サポート機能(2016/6/20現在)

  • 侵入防止
  • 変更監視
  • セキュリティログ監視保護

非サポート機能(2016/6/20現在)

  • マルウェア対策
  • ファイアウォール保護

注意点(2016/6/20現在)

Dockerでは、iptablesを利用しますが、Deep Securityがiptablesを停止してしまうため、停止しないように、/etc/use_dsa_with_iptablesの空ファイルを作成する必要があります。 Deep Security Agent と iptables について

テストした構成

AWS Elastic Beanstalk Dockerの単一コンテナ(docker singlecontainer)を使っています。AWS Elastic Beanstalk Dockerのサンプルに、.ebextentionsフォルダを作成し、以下のConfigを入れてzipにします。AWS Elastic Beanstalk Dockerへデプロイするとインスタンス起動時にDeep Security Agentがインストールされます。

苦労した点

Integrate Deep Security as a Service with AWS BeanstalkのElastic BeanstalkのLinuxサンプルを使って、use_dsa_with_iptablesを作成するよう追記したものでは、ランダムで起動時Deep Securityのアクティベーションで失敗する事象が発生しました。

原因(推測です。参考程度と考えてください)

Integrate Deep Security as a Service with AWS BeanstalkのLinux用ebextetionサンプル上の「waitAfterCompletion: 70」の部分は、Windowsのみ有効な値でした。

そのため、Deep Security Managerが出力するインストールスクリプトをそのままebextetionへ適応しました。

動作したebextention

Deep Security Managerから出力可能な、インストールスクリプトを元に、環境に応じて、01downlaoddsaや、05activatedsaを書き換えて利用ください。

% cat .ebextensions/deepsecurity.config
container_commands:
00configuredsa:
command: sudo touch /etc/use_dsa_with_iptables
01downloaddsa:
command: wget https://app.deepsecurity.trendmicro.com:443/software/agent/amzn1/x86_64/ -O /tmp/agent.rpm --quiet
02installdsa:
command: rpm --replacepkgs -ihv /tmp/agent.rpm
ignoreErrors: true
03sleep:
command: sleep 15
04dsacontrol:
command: /opt/ds_agent/dsa_control -r
05activatedsa:
command: >-
/opt/ds_agent/dsa_control
-a dsm://agents.deepsecurity.trendmicro.com:443/
"tenantID:REPLACE-WITH-YOUR-TENANT-ID"
"tenantPassword:REPLACE-WITH-YOUR-TENANT-PASSWORD"
"policyid:REPLACE-WITH-YOUR-POLICY-ID"

参考

.ebextensionsでAmazon LinuxにDeepSecurity Agentをインストールしてみた」 も参考にさせていただきました。

まとめ

どなたかのお役に立てれば幸いです。

この記事をシェアする

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.